<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GoodsClass extends Model {

    protected $table = 'goods_class';
    protected $guarded = [];

    public function goods() {
        return $this->hasMany('App\Models\Goods', 'class_id');
    }

    public function hasChildren() {
        return self::where('fid', $this->id)->exists();
    }

    public function childrens() {
        return self::where('fid', $this->id)->get();
    }

}
